var http = require('http')
var fs = require('fs')
http.createServer(function (resquest, response){
    if (resquest.url !== '/favicon.ico') {
        console.log(resquest.url)
        if (resquest.url === '/img') {
            response.writeHead(200, { 'Content-Type': 'image/jpeg' })
            fs.readFile('./img/img.jpg', 'binary', function (err, res) {
                if (err) {
                    response.write(err, 'binary')
                }else {
                    response.write(res, 'binary')
                }
                response.end()
            })
        }else {
            response.writeHead(200, { 'Content-Type': 'text/html;charset=UTF-8' })
            let data = fs.readFileSync('./vive/login.html')
            response.write(data)
            response.end()
        }
    }
}).listen(520)